<template>
	<div class="plan">
		<Collapse v-model="value">
			<Panel name="1">
				西药及药物禁忌指导
				<div class="wrapbox" slot="content">
					<Button class="addbutton" icon="plus-round" type="dashed" @click="showWest">新增西药及药物禁忌指导</Button>
					<div class="header">西药及药物禁忌指导</div>
					<v-table ref="vTable" :tableColumns="tableColumns" :tableData="tableData"></v-table>
				</div>
			</Panel>
			<Panel name="2">
				中药及药物禁忌指导
				<div class="wrapbox" slot="content">
					<Button class="addbutton" icon="plus-round" type="dashed" @click="showCh">新增中药及药物禁忌指导</Button>
					<div class="header">中药及药物禁忌指导</div>
					<v-table ref="vTableTwo" :tableColumns="tableColumnsTwo" :tableData="tableData2"></v-table>
				</div>
			</Panel>
			<Panel name="3">
				监测指导
				<div class="wrapbox" slot="content">
					<Button class="addbutton" icon="plus-round" type="dashed" @click="showMonitor">新增监测指导</Button>
					<div class="header">监测指导</div>
					<v-table ref="vTableThree" :tableColumns="tableColumnsThree" :tableData="tableData3"></v-table>
				</div>
			</Panel>
			<Panel name="4">
				就诊指导
				<div class="wrapbox" slot="content">
					<Button class="addbutton" icon="plus-round" type="dashed" @click="showVisit">新增就诊指导</Button>
					<div class="header">就诊指导</div>
					<v-table ref="vTableFour" :tableColumns="tableColumnsFour" :tableData="tableData4"></v-table>
				</div>
			</Panel>
			<Panel name="5">
				复查指导
				<div class="wrapbox" slot="content">
					<Button class="addbutton" icon="plus-round" type="dashed" @click="showReview">新增复查指导</Button>
					<div class="header">复查指导</div>
					<v-table ref="vTableFive" :tableColumns="tableColumnsFive" :tableData="tableData5"></v-table>
				</div>
			</Panel>
		</Collapse>
		
		<!--西药及药物禁忌指导 编辑 -->
		<Modal v-model="isWestShow" :width="400" class-name="eidthform" :mask-closable='false'>
			<p slot="header">{{editFormTitle}}</p>
			<Form ref="westForm" :model="westernMedicineVos" :label-width="70">
				<FormItem label="药物名称:">
	                <Input type="text" v-model="westernMedicineVos.westernMedicineName" placeholder="请输入药物名称"></Input>
	            </FormItem>
	            <FormItem label="用药时间:">
	            	<Input type="text" v-model="westernMedicineVos.westernMedicineTime" placeholder="例如：饭前、饭后"></Input>               
	            </FormItem>
	            <FormItem label="用法用量:">
	                <Input type="text" v-model="westernMedicineVos.westernMedicineDose" placeholder="例如：1粒 日/次"></Input>
	            </FormItem>
	            <FormItem label="注意事项:">
	                <Input type="textarea" :autosize="{minRows: 4}" v-model="westernMedicineVos.westernMedicineNote" placeholder="请输入注意事项"></Input>
	            </FormItem>
			</Form>
			<div slot="footer" class="button-box">
	            <Button type="primary" :loading="westKeep"  @click="keepWest('westForm')">保存</Button>
	            <Button type="ghost" @click="westCancel('westForm', 'isWestShow')">取消</Button>
	        </div>
		</Modal>
		
		<!-- 中药及药物禁忌指导 编辑 -->
		<Modal v-model="isChShow" :width="400" class-name="eidthform" :mask-closable='false'>
			<p slot="header">{{editFormTitle2}}</p>
			<Form ref="chForm" :model="chData" :label-width="70">
				<FormItem label="药物名称:">
	                <Input type="text" v-model="chData.chineseMedicineName" placeholder="请输入药物名称"></Input>
	            </FormItem>
	            <FormItem label="辩证:">
	                <Input type="text" v-model="chData.chineseMedicineCertificate" placeholder="请输入辩证"></Input>
	            </FormItem>
	            <FormItem label="治法:">
	                <Input type="text" v-model="chData.chineseMedicineSolution" placeholder="请输入治法"></Input>
	            </FormItem>
	            <FormItem label="用法用量:">
	                <Input type="text" v-model="chData.chineseMedicineUsage" placeholder="例如：1粒 日/次"></Input>
	            </FormItem>
	            <FormItem label="组成:">
	                <Input type="textarea" :autosize="{minRows: 4}" v-model="chData.chineseMedicineComposition" placeholder="请输入组成"></Input>
	            </FormItem>
			</Form>
			<div slot="footer" class="button-box">
	            <Button type="primary" :loading="chKeep"  @click="keepCh('chForm')">保存</Button>
	            <Button type="ghost" @click="chCancel('chForm', 'isChShow')">取消</Button>
	        </div>
		</Modal>
	
		<!-- 监测指导编辑 -->
		<Modal v-model="isMonitorShow" :width="400" class-name="eidthform" :mask-closable='false'>
			<p slot="header">{{editFormTitle3}}</p>
			<Form ref="monitorForm" :model="monitorData" :label-width="70">
				<FormItem label="测量指标:">
	                <Input type="text" v-model="monitorData.monitorNumber" placeholder="请输入测量指标"></Input>
	            </FormItem>
	            <FormItem label="测量次数:">
	                <Input type="text" v-model="monitorData.monitorIndex" placeholder="请输入测量次数"></Input>
	            </FormItem>
	            <FormItem label="测量时间:">
	            	 <Input type="text" v-model="monitorData.monitorTime" placeholder="请输入测量时间"></Input>
                	<!--<DatePicker type="date" @on-change="setTime" :value="monitorData.createTime" format="yyyy-MM-dd" placeholder="请选择测量日期" style="width: 100%"></DatePicker>-->	               
	            </FormItem>
	            <FormItem label="注意事项:">
	                <Input type="textarea" :autosize="{minRows: 4}" v-model="monitorData.monitorNote" placeholder="请输入注意事项"></Input>
	            </FormItem>
			</Form>
			<div slot="footer" class="button-box">
	            <Button type="primary" :loading="monitorKeep"  @click="keepMonitor('monitorForm')">保存</Button>
	            <Button type="ghost" @click="monitorCancel('monitorForm', 'isMonitorShow')">取消</Button>
	        </div>
		</Modal>
	
		<!-- 就诊指导编辑 -->
		<Modal v-model="isVisitShow" :width="400" class-name="eidthform" :mask-closable='false'>
			<p slot="header">{{editFormTitle4}}</p>
			<Form ref="visitForm" :model="visitData" :label-width="70">
				<FormItem label="就诊原因:">
					<Input type="text" v-model="visitData.treatmentReason" placeholder="请输入就诊原因"></Input>
	            </FormItem>
	            <FormItem label="就诊日期:">
                	<DatePicker type="date" :value="visitData.treatmentTime" format="yyyy-MM-dd HH:mm" @on-change="setVisitDate" placeholder="请选择就诊日期" style="width: 100%"></DatePicker>	  
                	<!--<TimePicker :disabled="isVisitDisabled" @on-change="setVisitTime" :value="timePicker" type="time" format="HH:" placeholder="请选择就诊时间" style="width: 130px; margin-left: 10px;"></TimePicker>-->
	            </FormItem>
	            <FormItem label="就诊科室:">
					<Input type="text" v-model="visitData.treatmentDepartment" placeholder="请输入就诊科室"></Input>
	            </FormItem>
	            <FormItem label="注意事项:">
					<Input type="textarea" :autosize="{minRows: 4}" v-model="visitData.treatmentNote" placeholder="请输入注意事项"></Input>
	            </FormItem>
			</Form>
			<div slot="footer" class="button-box">
	            <Button type="primary" :loading="visitKeep"  @click="keepVisit('visitForm')">保存</Button>
	            <Button type="ghost" @click="visitCancel('visitForm', 'isVisitShow')">取消</Button>
	        </div>
		</Modal>
	
		<!-- 复查指导编辑 -->
		<Modal v-model="isReviewShow" :width="400" class-name="eidthform" :mask-closable='false'>
			<p slot="header">{{editFormTitle5}}</p>
			<Form ref="reviewForm" :model="reviewData" :label-width="70">
				<FormItem label="复查项目:">
					<Input type="text" v-model="reviewData.reviewProject" placeholder="请输入复查项目"></Input>
	            </FormItem>
	            <FormItem label="复查时间:">
	            	<Input type="text" v-model="reviewData.reviewTime" placeholder="例如：三个月"></Input>        	            	
	            </FormItem>
	            <FormItem label="注意事项:">
					<Input type="textarea" :autosize="{minRows: 4}" v-model="reviewData.reviewDescription" placeholder="请输入复注意事项"></Input>
	            </FormItem>
			</Form>
			<div slot="footer" class="button-box">
	            <Button type="primary" :loading="reviewKeep"  @click="keepReview('reviewForm')">保存</Button>
	            <Button type="ghost" @click="reviewCancel('reviewForm', 'isReviewShow')">取消</Button>
	        </div>
		</Modal>
		
	</div>
</template>
<!-- 干预计划 -->
<script>
	import vTable from '@/components/common/Table.vue'
	export default {
		components: {
			vTable
		},
		data(){
			return {
				ImprovePeriodicalId: '',  // 周刊id
				customer_id: '',   //   人物id
				timePicker: '',
				value: '1',  //  默认展开第一层 
				isWestShow: false,		// 西药
				westKeep: false,		
				isChShow: false,		//  中药
				chKeep: false,   
				isMonitorShow: false,  //  监测指导
				monitorKeep: false,
				isVisitShow: false, 		//   就诊指导 
				visitKeep: false,
				isReviewShow: false,    //  复查项目
				reviewKeep: false,
				tableColumns: [
					{ type: "index", align: "center", width: 60 },
			        { title: "药物名称", key: "westernMedicineName", align: "center" },
			        { title: "用药时间", key: "westernMedicineTime", align: "center" },
			        { title: "用法用量", key: "westernMedicineDose", align: "center" },
			        { title: "注意事项", key: "westernMedicineNote", align: "center" },
			        {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: { type: 'primary', size: 'small' },
                                    style: { marginRight: '5px' },
                                    on: {
                                        click: () => {
                                        	this.isWestShow = true; //  显示西药弹框
                                        	this.editFormTitle = '编辑西药及药物禁忌指导';
											this.westernMedicineVos = JSON.parse(JSON.stringify(params.row)); //  赋值 
											this.westernMedicineVos.customer_id = this.$route.query.customer_id; // 赋值  customer_id
											console.log(this.westernMedicineVos)
                                        }
                                    }
                                }, '编辑')
                            ]);
                        }
                    }
				],
				tableColumnsTwo: [
					{ type: "index", align: "center", width: 60 },
			        { title: "药物名称", key: "chineseMedicineName", align: "center" },
			        { title: "辩证", key: "chineseMedicineCertificate", align: "center" },
			        { title: "治法", key: "chineseMedicineSolution", align: "center" },
			        { title: "用法用量", key: "chineseMedicineUsage", align: "center" },
			        { title: "组成", key: "chineseMedicineComposition", align: "center" },
			        {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: { type: 'primary', size: 'small' },
                                    style: { marginRight: '5px' },
                                    on: {
                                        click: () => {
                                        	this.isChShow = true; //  显示西药弹框
                                        	this.editFormTitle2 = '编辑中药及药物禁忌指导';
											this.chData = JSON.parse(JSON.stringify(params.row)); //  赋值 
											this.chData.customer_id = this.$route.query.customer_id; // 赋值  customer_id
											console.log(this.chData)
                                        }
                                    }
                                }, '编辑')
                            ]);
                        }
                    }			        
				],
				tableColumnsThree: [
					{ type: "index", align: "center", width: 60 },
			        { title: "测量指标", key: "monitorNumber", align: "center" },
			        { title: "测量次数", key: "monitorIndex", align: "center" },
			        { title: "测量时间", key: "monitorTime", align: "center" },
			        { title: "注意事项", key: "monitorNote", align: "center" },
			        {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: { type: 'primary', size: 'small' },
                                    style: { marginRight: '5px' },
                                    on: {
                                        click: () => {
                                        	this.isMonitorShow = true;  //  显示监测指导 弹框
                                        	this.editFormTitle3 = '编辑监测指导';
                                        	this.monitorData = JSON.parse(JSON.stringify(params.row))  //  赋值
                                        	this.monitorData.customer_id = this.$route.query.customer_id; // 赋值  customer_id
                                        }
                                    }
                                }, '编辑')
                            ]);
                        }
                    }
				],
				tableColumnsFour: [
					{ type: "index", align: "center", width: 60 },
			        { title: "就诊原因", key: "treatmentReason", align: "center" },
			        { title: "就诊时间", key: "treatmentTime", align: "center" },
			        { title: "就诊科室", key: "treatmentDepartment", align: "center" },
			        { title: "注意事项", key: "treatmentNote", align: "center" },
			        {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: { type: 'primary', size: 'small' },
                                    style: { marginRight: '5px' },
                                    on: {
                                        click: () => {
                                        	this.isVisitShow = true;  //  显示就诊指导 弹框
                                        	this.editFormTitle4 = '编辑就诊指导';
                                        	this.visitData = JSON.parse(JSON.stringify(params.row))  //  赋值
                                        	this.visitData.customer_id = this.$route.query.customer_id; // 赋值  customer_id
                                        }
                                    }
                                }, '编辑')
                            ]);
                        }
                    }
				],
				tableColumnsFive: [
					{ type: "index", align: "center", width: 60 },
			        { title: "复查项目", key: "reviewProject", align: "center" },
			        { title: "复查时间", key: "reviewTime", align: "center" },
			        { title: "注意事项", key: "reviewDescription", align: "center" },
			        {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: { type: 'primary', size: 'small' },
                                    style: { marginRight: '5px' },
                                    on: {
                                        click: () => {
                                        	this.isReviewShow = true;  //  显示就诊指导 弹框
                                        	this.editFormTitle5 = '编辑复查指导';
                                        	this.reviewData = JSON.parse(JSON.stringify(params.row))  //  赋值
                                        	this.reviewData.customer_id = this.$route.query.customer_id; // 赋值  customer_id
                                        }
                                    }
                                }, '编辑')
                            ]);
                        }
                    }
				],
				tableData: [],
				tableData2: [],
				tableData3: [],
				tableData4: [],
				tableData5: [],
				//  西药
				westernMedicineVos: {
					customer_id: '',
					westernMedicineName: '',
					westernMedicineTime: '',
					westernMedicineDose: '',
					westernMedicineNote: '',
					id: ''
				},
				//  中药
				chData: {
					customer_id: '',
					chineseMedicineName: '',
					chineseMedicineCertificate: '',
					chineseMedicineSolution: '',
					chineseMedicineUsage: '',
					chineseMedicineComposition: '',
					id: ''
				},
				//监测指导
				monitorData: {
					customer_id: '',
					monitorNumber: '',
					monitorIndex: '',
					monitorTime: '',
					monitorNote: '',
					id: ''
				},
				// 就诊指导
				visitData: {
					customer_id: '',
					treatmentReason: '',
					treatmentTime: '',
					treatmentDepartment: '',
					treatmentNote: '',
					id: ''
				},
				// 复查指导
				reviewData: {
					customer_id: '',
					reviewProject: '',
					reviewTime: '',
					reviewDescription: '',
					id: ''
				},
				isVisitDisabled: true,
				editFormTitle: '',  //  西药 标题
				editFormTitle2: '',  // 中药  标题
				editFormTitle3: '',  //  监测指导  标题
				editFormTitle4: '',  //  就诊指导  标题
				editFormTitle5: ''   //  复查指导  标题
			}
		},
		created(){
			this.ImprovePeriodicalId = this.$route.params.id; //  周刊id
			this.customer_id = this.$route.query.customer_id;  //  用户id
			
//			this.customer_id = this.$route.params.id;  
			//  所有的数据都要 customer_id
			this.westernMedicineVos.customer_id = this.$route.query.customer_id;
			this.chData.customer_id = this.$route.query.customer_id;
			this.monitorData.customer_id = this.$route.query.customer_id;
			this.visitData.customer_id = this.$route.query.customer_id;
			this.reviewData.customer_id = this.$route.query.customer_id;
			this.getData();
		},
		methods: {
			// 清空  西药及药物禁忌指导
			resetWestData(){
				this.westernMedicineVos.westernMedicineName = '';
				this.westernMedicineVos.westernMedicineTime = '';
				this.westernMedicineVos.westernMedicineDose = '';
				this.westernMedicineVos.westernMedicineNote = '';
				this.westernMedicineVos.id =  '';
			},
			// 清空 中药及药物禁忌指导
			resetChData(){
				this.chData.chineseMedicineName = '';
				this.chData.chineseMedicineCertificate = '';
				this.chData.chineseMedicineSolution = '';
				this.chData.chineseMedicineUsage = '';
				this.chData.chineseMedicineComposition = '';
				this.chData.id =  '';
			},
			// 清空  监测指导
			resetMonitorData(){
				this.monitorData.monitorNumber = '';
				this.monitorData.monitorIndex = '';
				this.monitorData.monitorTime = '';
				this.monitorData.monitorNote = '';
				this.monitorData.id = '';
			},
			// 清空  就诊指导
			resetVisitData(){
				this.visitData.treatmentReason = '';
				this.visitData.treatmentTime = '';
				this.visitData.treatmentDepartment = '';
				this.visitData.treatmentNote = '';
				this.visitData.id = '';
			},
			// 清空  复查指导
			resetReviewData(){
				this.reviewData.reviewProject = '';
				this.reviewData.reviewTime = '';
				this.reviewData.reviewDescription = '';
			},
			// 获取数据
			getData(){
				//   并发请求
				const western_medicine_guideApi =  '/improve/western_medicine_guide/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;  //  西药及药物禁忌指导
				const chinese_medicine_guideApi = '/improve/chinese_medicine_guide/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;   //  中药及药物禁忌指导
				const monitor_guidanceApi = '/improve/monitor_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;   //  监测指导
				const treatment_guidanceApi = '/improve/treatment_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;  //  就诊指导
				const review_guidanceApi =  '/improve/review_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;    //复查指导
				this.$http.all([
					this.$http.get(western_medicine_guideApi),
					this.$http.get(chinese_medicine_guideApi),
					this.$http.get(monitor_guidanceApi),
					this.$http.get(treatment_guidanceApi),
					this.$http.get(review_guidanceApi)
				])
				.then(this.$http.spread((res1,res2,res3,res4,res5)=>{
					this.tableData = res1.data.data;   //西药及药物禁忌指导
					this.tableData2 = res2.data.data;   //  中药及药物禁忌指导
					// //  监测指导
					this.tableData3 = res3.data.data;
					this.tableData4 = res4.data.data;   //  就诊指导
					this.tableData5 = res5.data.data;    //复查指导
				}))
				.catch((err)=>{
					console.log(err);
					this.$Notice.error({ title: "改善方案数据获取失败！" });
				})
			},
		
		//  修改  西药及药物禁忌指导
			editWest(){
				const update_western_guidance = '/improve/update_western_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(update_western_guidance, [this.westernMedicineVos]) //  因为这里需要传数组给后台，然而westernMedicineVos是个对象，因此需要加  [  ]
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isWestShow = false;
				})
				.catch((err)=>{
					console.log(err)
				})
			},
			//  新增  西药及药物禁忌指导  
 			addWest(){
 				const add_western_medicine = '/improve/add_western_medicine/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(add_western_medicine, this.westernMedicineVos)
				.then((res)=>{
					console.log(res)
					this.getData();
					this.isWestShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			//  弹出 西药及药物禁忌指导 编辑框
			showWest(){
				this.editFormTitle = '新增西药及药物禁忌指导';
				this.isWestShow = true;
				this.resetWestData(); //  清空  westernMedicineVos  数据
			},
			// 取消西药弹框
			westCancel(refName, showName){
				this.$refs[refName].resetFields();
				this[showName] = false;
			},
			//  保存西药  
			keepWest(refName){  
				// 通过 判断 标题来 请求接口 
				if(this.editFormTitle === '新增西药及药物禁忌指导') {
					this.addWest();
				} else {
					this.editWest()
				}
//				console.log(this.westernMedicineVos)
				
			},
			
			//  修改  中药及药物禁忌指导 
			editCh(){
				const update_chinese_guidance = '/improve/update_chinese_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(update_chinese_guidance, [this.chData])
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isChShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			// 新增  中药及药物禁忌指导 
			addCh(){
				const add_chinese_medicine = '/improve/add_chinese_medicine/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(add_chinese_medicine, this.chData)
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isChShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			//  弹出 中药及药物禁忌指导 编辑框
			showCh(){
				this.editFormTitle2 = '新增中药及药物禁忌指导';
				this.isChShow = true;
				this.resetChData();
			},
			//  保存中药  编辑
			keepCh(refName){
				// 通过 判断 标题来 请求接口 
				if(this.editFormTitle2 === '新增中药及药物禁忌指导') {
					this.addCh();
				} else {
					this.editCh();
				}
//				console.log(this.chData)
			},
			//  取消中药弹框
			chCancel(refName, showName){
				this.$refs[refName].resetFields();
				this[showName] = false;
			},
				 
			//  修改   监测指导  
			editMonitor(){ 
				const update_monitor_guidance = '/improve/update_monitor_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(update_monitor_guidance, [this.monitorData])
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isMonitorShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			// 新增  监测指导 
			addMonitor(){
				const add_monitor_guidance = '/improve/add_monitor_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(add_monitor_guidance, this.monitorData)
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isMonitorShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			// 弹出  监测指导  编辑框
			showMonitor(){
				this.editFormTitle3 = '新增监测指导';
				this.isMonitorShow = true;
				this.resetMonitorData();
			},
			//  保存监测指导编辑
			keepMonitor(refName){
				// 通过 判断 标题来 请求接口 
				if(this.editFormTitle3 === '新增监测指导') {
					this.addMonitor()
				} else {
					this.editMonitor()
				}
//				console.log(this.monitorData)
			},
			//  取消监测指导弹框
			monitorCancel(refName, showName){
				this.$refs[refName].resetFields();
				this[showName] = false;
			},
			
			
			// 修改   就诊指导  
			editVisit(){
				const update_treatment_guidance = '/improve/update_treatment_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(update_treatment_guidance, [this.visitData])
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isVisitShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			//  新增   就诊指导 
			addVisit(){
				const add_treatment_guidance = '/improve/add_treatment_guidance/'+ this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(add_treatment_guidance, this.visitData)
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isVisitShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			// 设置  就诊日期
			setVisitDate(date){
				console.log(date)
				this.isVisitDisabled = false;  //   选择完日期 才可以选择  时间  需要isVisitDisabled来控制
				this.visitData.treatmentTime = date;
			},
			// 弹出  就诊指导  编辑框
			showVisit(){
				this.editFormTitle4 = '新增就诊指导';
				this.isVisitShow = true;
				this.resetVisitData();
			},
			//  保存 就诊指导
			keepVisit(refName){
				// 通过 判断 标题来 请求接口 
				if(this.editFormTitle4 === '新增就诊指导') {
					this.addVisit();
				} else {
					this.editVisit();
				}
//				console.log(this.visitData)
			},
			//  取消就诊指导弹框
			visitCancel(refName, showName){
				this.$refs[refName].resetFields();
				this[showName] = false;
			},
		
			// 修改  复查指导 
			editReview(){
				const update_review_guidance = '/improve/update_review_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(update_review_guidance, [this.reviewData])
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isReviewShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			//  新增  复查指导 
			addReview(){
				const add_review_guidance = '/improve/add_review_guidance/' + this.customer_id + '?ImprovePeriodicalId=' + this.ImprovePeriodicalId;
				this.$http.post(add_review_guidance, this.reviewData)
				.then((res)=>{
					console.log(res);
					this.getData();
					this.isReviewShow = false;
				})
				.catch((err)=>{
					console.log(err);
				})
			},
			// 弹出  复查指导  编辑框
			showReview(){
				this.editFormTitle5 = '新增复查指导';
				this.isReviewShow = true;
				this.resetReviewData();
			},
			//  保存 复查指导 编辑
			keepReview(refName){
				// 通过 判断 标题来 请求接口 
				if(this.editFormTitle5 === '新增复查指导') {
					this.addReview();
				} else {
					this.editReview();
				}
			},
			//  取消复查指导 弹窗
			reviewCancel(refName, showName){
				this.$refs[refName].resetFields();
				this[showName] = false;
			}
		}
	}
</script>

<style lang="less">
	.plan{
		margin-left: 30px;
		.wrapbox {
			margin: 20px;
			.header{
				height: 40px;
				text-align: center;
				font-size: 20px;
				line-height: 40px;
				color: #fff;
				background: #0B9595;
				border-radius: 5px;
			}
			.button-box {
				width: 100%;
				text-align: center;
				
				.editTarget {
					margin-top: 20px;
				}
			}
		}
	}
</style>